Skip to content

Fixed a recursive inling bug, added a test for it #666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2025

Conversation

FractalFir
Copy link
Contributor

Fixes #599.

Instead of always translating #[inline(always)](which is a hint) to FnAttribute::AlwaysInline(which makes inlining mandatory), we now do so only for functions which don't call any functions with the #[inline(always)] or the rustc force inline attribute.

In cases where #[inline(always)] is applied to a function which might be recursive, it is demoted to #[inline] instead.
This breaks the cycle, and prevents libjitgcc errors.

The regression test checks for direct and indirect recursion.

Copy link
Contributor

@antoyo antoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Here are some nitpicks.

@FractalFir FractalFir force-pushed the master branch 3 times, most recently from f217230 to b6eb7c2 Compare May 9, 2025 19:43
Copy link
Contributor

@antoyo antoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicks about formatting and spelling.

Copy link
Contributor

@antoyo antoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few trailing ; to remove.
I believe I can merge this after this is fixed.

@antoyo antoyo merged commit d8e2d24 into rust-lang:master May 11, 2025
37 checks passed
@antoyo
Copy link
Contributor

antoyo commented May 11, 2025

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix #[inline(always)] for recursive functions
2 participants